home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
AVOGADRO
/
CHEMISTRY
/
MOLEDRAW
/
!MoleDraw
/
docs
/
mdobjs
< prev
next >
Wrap
Text File
|
1995-12-24
|
4KB
|
143 lines
/*
mdobjs.h - data used in MoleDraw files
This header file is 'Freeware'. You may do anything with it (in part or
as a whole) except sell it or remove this message.
(c) Simon Kilvington, 1994.
*/
#ifndef __mdobjs_h__
#define __mdobjs_h__
/*
A MoleDraw file is a DrawFile with a connection table object. Each bond
is a tagged object, the extra data is used to identify the atoms it
connects. Each atom label is another type of tagged object with similar
data associated with it.
Two other tagged objects are used. Aromatic ring objects, these are the
circles at the centre of aromatic rings, and are used when writing SMILES
strings. Finally, arrow head objects, these are tagged so they can be
altered by the 'Style' menu.
The DrawFile object number and the tag numbers are registered with Acorn.
*/
/* standard RISC OS Lib definitions; we only use 'draw_objhdr' in here */
#include "drawftypes.h"
/* connection table's DrawFile object type */
#define md_CONTABLEOBJ 0x1C0
/* tagged objects and data associated with them */
#define md_BONDTAG 0x800
#define md_LABELTAG 0x801
#define md_AROMATICRINGTAG 0x802
#define md_ARROWHEADTAG 0x803
typedef struct
{
int atom1; /* the two atoms it connects */
int atom2; /* atom2 > atom1 */
} md_bondtagdata;
typedef struct
{
int atom; /* atom no. (ie it's index in the connection table) */
} md_labeltagdata;
/* no data associated with aromatic ring objects */
typedef struct
{
int style; /* in 'Arrow heads' menu order, first style is 0 */
} md_arrowheadtagdata;
/* types of bonds */
typedef char md_bondtype;
#define BONDTYPE_Line (md_bondtype) 0x0; /* no special features */
#define BONDTYPE_Dash (md_bondtype) 0x1;
#define BONDTYPE_Bold (md_bondtype) 0x2;
#define BONDTYPE_BoldDash (md_bondtype) 0x3;
#define BONDTYPE_WedgeOut (md_bondtype) 0x4;
#define BONDTYPE_WedgeOutDash (md_bondtype) 0x5;
#define BONDTYPE_WedgeIn (md_bondtype) 0x6;
#define BONDTYPE_WedgeInDash (md_bondtype) 0x7;
#define BONDTYPE_Wiggle (md_bondtype) 0x8;
#define BONDTYPE_CentredBit (md_bondtype) 0x10;
/* CentredBit only applies to double bonds, it is either off or on */
/* allowed bond orders */
typedef char md_bondorder;
#define BONDORDER_NoBond (md_bondorder) 0;
#define BONDORDER_Single (md_bondorder) 1;
#define BONDORDER_Double (md_bondorder) 2;
#define BONDORDER_Triple (md_bondorder) 3;
/* label positions */
typedef char md_labeltype;
#define LABELTYPE_None (md_labeltype) 0; /* this atom not labeled */
#define LABELTYPE_Dot (md_labeltype) 1; /* labeled with a dot, not text */
#define LABELTYPE_Left (md_labeltype) 2; /* atom at leftmost char in text */
#define LABELTYPE_Centre (md_labeltype) 3;
#define LABELTYPE_Right (md_labeltype) 4;
#define LABELTYPE_Above (md_labeltype) 5; /* label is vertical, above atom */
#define LABELTYPE_Below (md_labeltype) 6;
/* arrow head styles */
#define ARROWHEAD_Filled (int) 0;
#define ARROWHEAD_FilledHalf (int) 1;
#define ARROWHEAD_Open (int) 2;
#define ARROWHEAD_OpenHalf (int) 3;
/* more may be added later, however these 4 will not change */
/* connection table data structures */
#define md_MAXBONDS 8 /* max atoms that an atom can be bonded to */
#define md_MAXORDER 3 /* max number of bonds between two atoms */
#define md_NOBOND -1 /* used in bondedto[] arrays */
/* data stored about each atom in connection table */
typedef struct
{
int x, y; /* in Draw coords */
int bondedto[md_MAXBONDS]; /* atoms it's connected to, md_NOBOND => no bond */
md_bondorder bondorder[md_MAXBONDS]; /* bondorder[B] only valid if bondedto[B]!=md_NOBOND */
md_bondtype btype[md_MAXBONDS][md_MAXORDER];
md_labeltype ltype;
char reserved[3];
} md_atomdetails;
/* and a whole connection table */
typedef struct
{
draw_objhdr hdr; /* bbox is set to 0,0,0,0 */
int natoms;
md_atomdetails atom[1]; /* array extends to atom[natoms-1] */
} md_connectiontable;
#define md_CONTABHDRSIZE (sizeof(md_connectiontable) - sizeof(md_atomdetails))
/* some things missing from drawftypes.h */
#define draw_OBJTAGGED 7
typedef struct
{
draw_objhdr hdr;
int tag;
} draw_taggedobjhdr;
#endif